package com.cxria.script;

import org.junit.Test;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

class FuncUtilsTest {

    def exceFunc = { a, b ->
        a + b
    }

    def resFunc = { result ->
        result == 3
    }

    @Test
    void tryNum() {
        FuncUtils.tryFunc(3, {
            byte[] bytes = new byte[1024]
            new ByteArrayInputStream(bytes)
        })
    }

    @Test
    void tryNumByResult() {
        FuncUtils.tryFunc(3, exceFunc, [1,2], resFunc)
    }

}